<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="rw.ac.kiosc.jdbc.school.School" %>
<%@page import="rw.ac.kiosc.jdbc.school.orm.User" %>
<%
        School school = new School();
        User user = null;
        String userIp = (String) session.getAttribute("userIp");
        int id = 0;
        String userId = (String) session.getAttribute("userId");
        if (userIp != null && userId != null) {
            try {
                id = Integer.parseInt(userId);
            } catch (Exception ex) {
            }
            if (userIp.equals(request.getRemoteAddr())) {
                user = school.getUserDAO().getUserById(id);
                if (user != null) {
                    response.sendRedirect("home.htm");
                }
            }
        }
        response.sendRedirect("login.htm");
%>